import type { MockMethod } from "vite-plugin-mock";

const noteList = {
  code: 200,
  msg: "获取菜单列表成功",
  data: [
    { id: 1, title: "SB知识库", content: "SB知识库内容" },
    { id: 2, title: "BD知识库", content: "BD知识库内容" },
    { id: 3, title: "SB知识库", content: "SB知识库内容" },
    { id: 4, title: "BD知识库", content: "BD知识库内容" },
    { id: 5, title: "SB知识库", content: "SB知识库内容" },
  ],
};

const noteDetail = {
  code: 200,
  msg: "获取节点详情成功",
  data: {
    id: 1,
    title: "SB知识库详情",
    content: "SB知识库详情内容",
  },
};

export default [
  {
    url: "/api/v1/note",
    method: "get",
    response: () => {
      return noteList;
    },
  },
  {
    url: "/api/v1/note/:id",
    method: "get",
    response(request: any) {
      // console.log(request);
      noteDetail.data.id = Number(request.query.id);
      return noteDetail;
    },
  },
] as MockMethod[];
